Skip to content

Merge Sort in C#: .NET 10 upgrade and copy-per-call benchmark - #2374

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/67815-csharp-merge-sort
Nov 10, 2026
Merged

vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/67815-csharp-merge-sort

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Upgrades csharp-algorithms/MergeSort to net10.0 with BenchmarkDotNet 0.15.8, MSTest 4.5.2, Microsoft.NET.Test.Sdk 18.11.0 and coverlet.collector 10.1.0. The benchmark moves into a new MergeBenchmarks class that copies its input before every call (the old benchmark sorted the same array in place, so every call after the first measured sorted data) and adds MemoryDiagnoser; Program.cs passes args to BenchmarkRunner. The benchmark-only arrayName parameter is removed so SortArray matches the article, the CollectionAssert argument order is fixed, and two tests compare the sort against Array.Sort on random and edge-case input.

…ith article

Target net10.0 with BenchmarkDotNet 0.15.8, MSTest 4.5.2, Microsoft.NET.Test.Sdk 18.11.0 and coverlet.collector 10.1.0. Move the benchmark into MergeBenchmarks, which copies its input before every call so each invocation sorts unsorted data, and add MemoryDiagnoser. Drop the benchmark-only arrayName parameter so SortArray matches the article. Fix the CollectionAssert argument order and add oracle and edge-case tests.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit f116f22 into CodeMazeBlog:main Nov 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant